﻿using System.Threading;
namespace System.Web
{
    public partial class NetHttpApplication
    {
        internal class SyncEventExecutionStep : IExecutionStep
        {
            private NetHttpApplication _application;
            private EventHandler _handler;

            internal SyncEventExecutionStep(NetHttpApplication app, EventHandler handler)
            {
                _application = app;
                _handler = handler;
            }

            internal EventHandler Handler
            {
                get { return _handler; }
            }

            void IExecutionStep.Execute()
            {
                if (_handler != null)
                    _handler(_application, _application.AppEvent);
            }

            bool IExecutionStep.CompletedSynchronously
            {
                get { return true; }
            }

            bool IExecutionStep.IsCancellable
            {
                get { return true; }
            }
        }
    }
}
